package com.ysy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum NoteStatusEnum {
    //  状态(0：待审核 1：正常 2：删除 3：下架)
    // Status (0: Pending Review 1: Normal 2: Deleted 3: Deactivated)

    PENDING_REVIEW(0,"待审核"),
    NORMAL(1,"正常"),
    DELETED(2,"删除"),
    DEACTIVATED(3,"下架");

    private int status;
    private String desc;

    private static Map<Integer, NoteStatusEnum> cache;

    static {
        cache = Arrays.stream(NoteStatusEnum.values()).collect(Collectors.toMap(NoteStatusEnum::getStatus, e -> e));
    }

    public static NoteStatusEnum get(int status) {
        return cache.get(status);
    }
}
